<div class="container">
    <form class="form-horizontal" name="backendUserForm">
        <br>
        <br>

        <div class="form-group">
            <label for="inputLoginId" class="control-label col-xs-2">城市:</label>

            <div class="col-xs-5">
                <select id="aa" ng-model="city">
                    <option>上海</option>
                    <option>北京</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="inputLoginId" class="control-label col-xs-2">小区名称:</label>

            <div class="col-xs-5">
                <input id="name_search" type="text" class="form-control"
                       ng-model="community.name" required
                       ng-change="nameChange(community.name)">
            </div>
        </div>
        <div class="form-group">
            <label for="inputUserName" class="control-label col-xs-2">小区地址:</label>

            <div class="col-xs-5">
                <input type="text" class="form-control" ng-model="community.address" id="community_address"
                       required>
            </div>
        </div>
        <div class="form-group">
            <label for="inputUserName" class="control-label col-xs-2">经纬度:</label>

            <div class="col-xs-5">
                <input type="text" class="form-control" ng-model="community.lng" id="community_lng" pattern="^(-?\d+)(\.\d+)?$"
                       required>
                <br>
                <input type="text" class="form-control" ng-model="community.lat" id="community_lat" pattern="^(-?\d+)(\.\d+)?$"
                       required>
            </div>
        </div>
        <div class="form-group">
            <label for="inputUserName" class="control-label col-xs-2">小区logo:</label>

            <div class="col-xs-5">
                <input type="file" id="pict" required
                       onchange="angular.element(this).scope().selectFile(this.files)" accept="image/*">
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-xs-2">生效日期:</label>

            <div class="col-md-2">
                <input type="text" id="effective" data-provide="datepicker"
                       class="form-control datepicker" data-date-format="yyyy-mm-dd"
                       ng-model="community.dateEffective" required>
            </div>
        </div>

        <div class="form-group">
            <label for="inputUserName" class="control-label col-xs-2">户数:</label>

            <div class="col-xs-5">
                <input type="text" class="form-control" ng-model="community.households" id="inventory"
                       required>
            </div>
        </div>

        <div class="form-group">
            <label class="control-label col-xs-2" for="inputUserName">是否显示单元号开关：</label>
            <div class="col-xs-5">
            <input type="checkbox" ng-model="community.unitSwitch"></div>
        </div>

        <div class="modal-footer">
            <button id="saveButton" type="submit" class="btn btn-default"
                    ng-click="saveCommunity(community)">保存
            </button>
            <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="cancelAddCommunity()">取消
            </button>
        </div>
    </form>
</div>
<script>


    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        }
        if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
                (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o) if (new RegExp("(" + k + ")").test(format))
            format = format.replace(RegExp.$1,
                    RegExp.$1.length == 1 ? o[k] :
                            ("00" + o[k]).substr(("" + o[k]).length));
        return format;
    }

    var fromDate = $('#startDate').datepicker().on('changeDate', function (ev) {
        //alert(ev.date.format('yyyy-MM-dd'));
        //$scope.startDate=ev.date.format('yyyy-MM-dd');
        $("#startDate").val(ev.date.format('yyyy-MM-dd'));
    });

    var toDate = $('#endDate').datepicker().on('changeDate', function (ev) {
        // alert(ev.date.format('yyyy-MM-dd'));
        //$scope.endDate=ev.date.format('yyyy-MM-dd');
        $("#endDate").val(ev.date.format('yyyy-MM-dd'));
    });

</script>